package com.iplant.aps.service;

import com.iplant.aps.service.po.APIResult;
import com.iplant.aps.service.po.OutResult;
import com.iplant.aps.service.po.Pagination;
import com.iplant.aps.service.po.ServiceResult;
import com.iplant.aps.service.po.aps.APSBOMItem;
import com.iplant.aps.service.po.aps.APSTaskStepCancelLogBPM;
import com.iplant.aps.service.po.bms.BMSEmployee;
import com.iplant.aps.service.po.bpm.BPMTaskBase;
import com.iplant.aps.service.po.excel.ExcelData;
import com.iplant.aps.service.po.ipt.IPTOutsourcingMaterial;
import com.iplant.aps.service.po.mss.MSSBOM;
import com.iplant.aps.service.po.mss.MSSBOMItem;
import com.iplant.aps.service.po.mss.MSSMaterial;
import com.iplant.aps.service.po.sfc.SFCBOMTaskItem;
import com.iplant.aps.service.po.tcm.TCMMaterialChangeItems;
import com.iplant.aps.service.po.tcm.TCMTechChangeNotice;
import com.iplant.aps.service.po.wms.*;
import com.iplant.aps.service.utils.Configuration;

import java.util.Calendar;
import java.util.List;

public interface WMSService {

    String ServerUrl = Configuration.readConfigString("wms.server.url", "config/config");

    String ServerName = Configuration.readConfigString("wms.server.project.name", "config/config");

    APIResult MSS_QueryBOM(BMSEmployee wLoginUser, int wBOMID, String wBOMNo, int wRouteIDF);

    APIResult MSS_SaveBOM(BMSEmployee wLoginUser, MSSBOM wMSSBOM);

    APIResult MSS_SaveBOMItem(BMSEmployee wLoginUser, MSSBOMItem wMSSBOMItem);

    APIResult MSS_QueryBOMAll(BMSEmployee wLoginUser, String wName, String wBOMNo, int wWorkShopID, int wBOMType,
                              int wProductID, int wStatus);

    APIResult MSS_QueryBOMItemAll(BMSEmployee wLoginUser, int wBOMID, int wLineID, int wProductID, int wCustomerID,
                                  int wPlaceID, int wPartPointID, int wBOMType, int wReplaceType, int wRouteID);

    APIResult MSS_QueryBOMItemByID(BMSEmployee wLoginUser, int wBOMItemID);

    APIResult MSS_QueryUnitList(BMSEmployee wLoginUser);

    APIResult MSS_QueryMaterialList(BMSEmployee wLoginUser, String wMaterialNo);

    APIResult MSS_QueryMaterialByID(BMSEmployee wLoginUser, int wMaterialID);

    APIResult MSS_SaveMaterial(BMSEmployee wLoginUser, MSSMaterial wMSSMaterial);

    APIResult APS_SaveBOMItemList(BMSEmployee wLoginUser, List<APSBOMItem> wAPSBOMItemList);

    APIResult MSS_ConfigAll(BMSEmployee wLoginUser, String wPartConfigNo, String wPartConfigName, int wActive,
                            String wProductNo, int wCustomerID, int wLineID);

    APIResult APS_OrderStart(BMSEmployee wLoginUser, int wLineID, int wProductID, int wCustomerID, int wOrderID,
                             String wWBSNo, String wPartNo);

    APIResult APS_BOMItemUpdate(BMSEmployee wLoginUser, APSBOMItem wAPSBOMItem);

    ServiceResult<List<WMSPickDemand>> WMS_QueryPickDemandList(BMSEmployee wLoginUser, String wOrderType,
                                                               String wDemandNo, int wProductID, int wLineID,
                                                               int wCustomerID, String wOrderID, int wPartID,
                                                               int wStatus,
                                                               String wMaterial, Calendar wStartTime,
                                                               Calendar wEndTime, int wSourceType, int wSendStatus,
                                                               Calendar wPreSendStartDate, Calendar wPreSendEndDate,
                                                               Pagination wPagination, String wSourceTypeNot,
                                                               String wOrderTypeNot, int wIsFinish);

    ServiceResult<WMSPickDemand> WMS_QueryPickDemand(BMSEmployee wLoginUser, int wDemandID, int wIsWaveNumber);

    ServiceResult<Integer> WMS_TriggerPickDemandTask(BMSEmployee wLoginUser, int wOrderID, int wPartID);

    /**
     * 手动推送
     */
    ServiceResult<Integer> WMS_ManualPush(BMSEmployee wLoginUser, int wDemandID);

    /**
     * 分拣
     */
    ServiceResult<Integer> WMS_Sorting(BMSEmployee wLoginUser, int wDemandID, int wStatus, String wLoginID);

    /**
     * 显示交接二维码
     *
     * @param wLoginUser 登录信息
     * @param wDemandID  物料配送单ID
     * @return 二维码网络路径
     */
    ServiceResult<String> WMS_ShowQRCode(BMSEmployee wLoginUser, int wDemandID, int wIsWaveNumber);

    /**
     * 查询在线物料
     *
     * @param wLoginUser    登录信息
     * @param wProductID    车型ID
     * @param wLineID       修程ID
     * @param wCustomerID   局段ID
     * @param wOrderID      订单ID
     * @param wPartID       工位ID
     * @param wStepID       工序ID
     * @param wMaterial     物料编码或物料名称
     * @param wStatus       订单ID
     * @param wMaterialType 物料类型
     * @return 在线物料列表
     */
    ServiceResult<List<WMSPickDemandItem>> WMS_QueryOnlineMaterial(BMSEmployee wLoginUser, int wProductID, int wLineID,
                                                                   int wCustomerID, int wOrderID, int wPartID,
                                                                   int wStepID, String wMaterial, int wStatus,
                                                                   int wMaterialType);

    /**
     * 工艺变更 处理物料配送单
     *
     * @param wLoginUser           登录信息
     * @param wTCMTechChangeNotice 工艺变更通知单
     * @param wItemList            工艺变更明细
     * @return 是否成功标识
     */
    ServiceResult<Integer> WMS_TechChange(BMSEmployee wLoginUser, TCMTechChangeNotice wTCMTechChangeNotice,
                                          List<TCMMaterialChangeItems> wItemList);

    /**
     * 领料需求单转换为领料需求取消单
     */
    WMSLinePartLLCancel GetWMSLinePartLLCancel(WMSPickDemand wWMSPickDemand);

    WMSLinePartLLCancel GetWMSLinePartLLCancel(WMSBatchPickDemand wWMSBatchPickDemand);

    /**
     * 工序取消工艺变更处理
     */
    void WMS_TaskStepCancelTechChange(BMSEmployee wLoginUser, APSTaskStepCancelLogBPM wData);

    /**
     * 触发退料需求清单
     *
     * @param wLoginUser 登录信息
     * @param wOrderID   订单ID
     * @param wPartID    工位ID
     * @return 错误码
     */
    ServiceResult<Integer> WMS_TriggerMaterialReturn(BMSEmployee wLoginUser, int wOrderID, int wPartID);

    /**
     * 条件查询产线工位退料需求
     */
    ServiceResult<List<MESMaterialReturn>> MES_QueryMaterialReturnList(BMSEmployee wLoginUser, String wAsnType,
                                                                       String wRMaNO, int wProductID, int wLineID,
                                                                       int wCustomerID, int wOrderID, int wPartID,
                                                                       int wStatus,
                                                                       String wMaterial, Calendar wStartTime,
                                                                       Calendar wEndTime, int wUpFlowID);

    ServiceResult<MESMaterialReturn> MES_QueryMaterialReturn(BMSEmployee wLoginUser, int wDemandID);

    /**
     * 手动推送物料退料单
     *
     * @param wDemandID 物料退料单ID
     * @return 推送错误信息
     */
    ServiceResult<Integer> MES_ManualPushMaterialReturn(BMSEmployee wLoginUser, int wDemandID);

    /**
     * 退料模拟
     */
    ServiceResult<Integer> MES_BackMaterial(BMSEmployee wLoginUser, int wDemandID);

    /**
     * 获取
     */
    ServiceResult<Double> WMS_GetRealLLNumber(BMSEmployee sysAdmin, double wMinPack, int materialID,
                                              double wNeedNumber, int wAreaID,
                                              OutResult<Integer> wErrorCode);

    ServiceResult<List<WMSLineEdgeLibrary>> WMS_QueryLineEdgeLibraryList(BMSEmployee wLoginUser, String wMaterial,
                                                                         Calendar wStartTime, Calendar wEndTime,
                                                                         int wSourceType, int wAreaID,
                                                                         String wBatchNumber);

    ServiceResult<WMSLineEdgeLibrary> WMS_QueryLineEdgeLibrary(BMSEmployee wLoginUser, int wWMSLineEdgeID);

    /*
     * 测试报工
     */
    ServiceResult<Integer> WMS_TestReport(BMSEmployee wLoginUser, int wItemID);

    ServiceResult<List<WMSPickDemand>> WMS_QueryPickDemandEmployeeAll(BMSEmployee wLoginUser, int wTagType,
                                                                      Calendar wStartTime, Calendar wEndTime);

    ServiceResult<List<MESMaterialReturn>> MES_QueryMaterialReturnListEmployeeAllWeb(BMSEmployee wLoginUser,
                                                                                     String wAsnType, String wCode,
                                                                                     int wProductID, int wLineID,
                                                                                     int wCustomerID, int wOrderID,
                                                                                     int wPartID,
                                                                                     String wMaterial,
                                                                                     Calendar wStartTime,
                                                                                     Calendar wEndTime, int wStatus);

    ServiceResult<Integer> WMS_CreateOutRepairReceipt(BMSEmployee wLoginUser, List<IPTOutsourcingMaterial> wList);

    ServiceResult<Integer> WMS_MPSDisassembly(BMSEmployee wLoginUser, int wDemandID);

    ServiceResult<Integer> WMS_CopyPickDemand(BMSEmployee wLoginUser, int wID);

    ServiceResult<Integer> WMS_CancelDistribution(BMSEmployee wLoginUser, int wDemandID);

    ServiceResult<List<BPMTaskBase>> WMS_QueryMaterialReturnEmployeeAll(BMSEmployee wLoginUser, int wTagTypes,
                                                                        Calendar wStartTime, Calendar wEndTime);

    ServiceResult<Integer> WMS_UpdateMaterialReturn(BMSEmployee wLoginUser, MESMaterialReturn wMESMaterialReturn);

    ServiceResult<String> WMS_ShowReturnQRCode(BMSEmployee wLoginUser, int wReturnTaskID);

    ServiceResult<Integer> WMS_CodeScanningHandover(BMSEmployee wLoginUser, String wCode);

    ServiceResult<Integer> WMS_ManualPushMaterialReturn(BMSEmployee wLoginUser, int wReturnID);

    ServiceResult<Integer> WMS_LineInventoryCount(BMSEmployee wLoginUser, int wLineEdgeID, double wFQTY);

    ServiceResult<List<WMSInventoryCheck>> WMS_QueryLineInventoryList(BMSEmployee wLoginUser, int wLineEdgeID);

    ServiceResult<String> WMS_ExportPrintFile(BMSEmployee wLoginUser, int wReturnID);

    ServiceResult<WMSAreaStock> WMS_QueryAreaStock(BMSEmployee wLoginUser, int wID);

    ServiceResult<Integer> WMS_UpdateAreaStock(BMSEmployee wLoginUser, WMSAreaStock wWMSAreaStock);

    ServiceResult<List<WMSAreaStock>> WMS_QueryAreaStockList(BMSEmployee wLoginUser, int wAreaID, String wMaterial,
                                                             String wBatchNumber, String wSerialNo,
                                                             Calendar wStartTime, Calendar wEndTime);

    ServiceResult<WMSBatchPickDemand> WMS_QueryBatchPickDemand(BMSEmployee wLoginUser, int wID);

    ServiceResult<List<WMSBatchPickDemand>> WMS_QueryBatchPickDemandList(BMSEmployee wLoginUser, String wDemandNo,
                                                                         int wProductID, int wLineID, int wStatus,
                                                                         String wWMSDemandNo, String wSourceCode,
                                                                         int wShortageIdentification,
                                                                         String wOriginalOrderNo, Calendar wStartTime
            , Calendar wEndTime);

    ServiceResult<Integer> WMS_UpdateBatchPickDemand(BMSEmployee wLoginUser, WMSBatchPickDemand wWMSBatchPickDemand);

    ServiceResult<Integer> WMS_ManualPushatchPickDemand(BMSEmployee wLoginUser, int wDemandID);

    ServiceResult<String> WMS_ShowQRCodeBatchPickDemand(BMSEmployee wLoginUser, int wDemandID);

    ServiceResult<Integer> WMS_CancelDistributionBatchPickDemand(BMSEmployee wLoginUser, int wDemandID);

    ServiceResult<Integer> WMS_UpdateBatchPickDemandItem(BMSEmployee wLoginUser,
                                                         WMSBatchPickDemandItem wWMSBatchPickDemandItem);

    ServiceResult<Integer> WMS_IncomingLineSideLibrary(BMSEmployee wLoginUser, int wDemandID);

    ServiceResult<List<WMSBatchPickDemand>> WMS_QueryBatchPickDemandEmployeeAll(BMSEmployee wLoginUser, int wTagType,
                                                                                Calendar wStartTime, Calendar wEndTime);

    ServiceResult<Integer> WMS_QueryOutQRCode(BMSEmployee wLoginUser, int wDemandID);

    ServiceResult<List<WMSPickDemandItemStock>> WMS_QueryPickDemandItemStockList(BMSEmployee wLoginUser, int wTaskID,
                                                                                 String wBatchNumber, String wSerialNo);

    ServiceResult<List<WMSBatchPickDemandItemStock>> WMS_QueryBatchPickDemandItemStockList(BMSEmployee wLoginUser,
                                                                                           int wTaskID,
                                                                                           String wBatchNumber,
                                                                                           String wSerialNo);

    ServiceResult<List<WMSLineEdgeLibrary>> WMS_BatchSourceList(BMSEmployee wLoginUser, int wPartID, int wSourceType,
                                                                int wProductID, int wLineID);

    ServiceResult<Integer> WMS_LineEdgeCovaUse(BMSEmployee wLoginUser, List<SFCBOMTaskItem> wSFCBOMTaskItemList,
                                               List<APSBOMItem> wAPSBOMItemList);

    ServiceResult<String> WMS_OutPrint(BMSEmployee wLoginUser, int wWMSPickDemandID);

    ServiceResult<String> WMS_ExportDemandItemList(BMSEmployee wLoginUser, int wDemandID);

    ServiceResult<Integer> WMS_CancelPartDemandItem(BMSEmployee wLoginUser, List<Integer> wStepIDList, int wDemandID);

    ServiceResult<Integer> WMS_TestERPUse(BMSEmployee wLoginUser, int wAPSBOMID, int wSFCBOMTaskID,
                                          int wSFCBOMTaskItemID, int wWMSLineEdgeLibraryID);

    ServiceResult<String> WMS_PickDemandExportItemAll(BMSEmployee wLoginUser, String wDemandIDs);

    ServiceResult<List<MESMaterialReturn>> WMS_QueryMaterialReturnEmployeeAllNew(BMSEmployee wLoginUser,
                                                                                 Calendar wStartTime,
                                                                                 Calendar wEndTime, int wStatus);

    ServiceResult<Integer> WMS_IncomingLineSideLibrary_1(BMSEmployee wLoginUser, int wDemandID);

    ServiceResult<Integer> WMS_RecoilMaterialUse(BMSEmployee wLoginUser, int wWMSPickDemandItemID);

    ServiceResult<Integer> WMS_BatchConfirmPickDemandItem(BMSEmployee wLoginUser, String wPickDemandIDs,
                                                          List<WMSPickDemandItem> wItemList);

    ServiceResult<List<WMSPickDemandItem>> WMS_QueryItemAllByDemandIDs(BMSEmployee wLoginUser, String wDemandIDs);

    ServiceResult<Integer> WMS_QueryOutCodes(BMSEmployee wLoginUser, String wIDs);

    ServiceResult<Integer> WMS_ReCodeAndSend(BMSEmployee wLoginUser, String wDemandNo);

    ServiceResult<Integer> WMS_UpdateSourceID(BMSEmployee wLoginUser);

    ServiceResult<Integer> WMS_RecoilUseUpdate(BMSEmployee wLoginUser, int wWMSLineEdgeLibraryID);

    ServiceResult<List<WMSBatchPickDemand>> WMS_QueryBatchPickDemandListByIDs(BMSEmployee wLoginUser, String wIDs,
                                                                              int wMaterialID, String wBatchNumber);

    ServiceResult<List<WMSPickDemand>> WMS_QueryWMSPickDemandListByIDs(BMSEmployee wLoginUser, String wIDs,
                                                                       int wMaterialID, String wBatchNumber);

    ServiceResult<Integer> WMS_RePostTheBackFlushedMaterials(BMSEmployee wLoginUser,
                                                             List<WMSLineEdgeLibraryItem> wWMSLineEdgeLibraryItemList);

    ServiceResult<Integer> WMS_UpdateAPSBOMItemID(BMSEmployee wLoginUser);

    ServiceResult<Integer> WMS_RePostAll(BMSEmployee wLoginUser);

    ServiceResult<Integer> WMS_ResendCanceled(BMSEmployee wLoginUser, ExcelData result);

    ServiceResult<String> WMS_QueryErrorIDs(BMSEmployee wLoginUser);

    ServiceResult<Integer> WMS_AutoProofread(BMSEmployee wLoginUser);

    ServiceResult<Integer> WMS_ManualPushBatch(BMSEmployee wLoginUser, String wDemandIDs);

    ServiceResult<List<WMSBatchPickDemand>> WMS_QueryBatchLineEdgeSource(BMSEmployee wLoginUser, int wWMSLineEdgeID);

    ServiceResult<List<WMSPickDemand>> WMS_QueryRecoilLineEdgeSource(BMSEmployee wLoginUser, int wWMSLineEdgeID);

    ServiceResult<Integer> WMS_UpdateTotal(BMSEmployee wLoginUser);

    void WMS_AutoTransferItems(BMSEmployee wLoginUser);

    ServiceResult<List<WMSLineEdgeLibraryItem>> WMS_QueryUseList(BMSEmployee wLoginUser, int wProductID, int wLineID,
                                                                 int wCustomerID, String wOrderIDs, int wPartID,
                                                                 int wPartPointID, String wMaterial, int wAreaID,
                                                                 int wIsPost,
                                                                 String wBatchNumber, String wPostMsgLike,
                                                                 Calendar wStartTime, Calendar wEndTime,
                                                                 Pagination wPagination);

    ServiceResult<Integer> WMS_SynchronizedToWMS(BMSEmployee wLoginUser, int wDemandID,boolean wIsUpdateWorkSpace);

    ServiceResult<List<WMSPickDemandItemStock>> WMS_QueryQueryAllByTaskIDList(BMSEmployee wLoginUser, String wTaskIDs);

    ServiceResult<String> WMS_BatchGetNewCode(BMSEmployee wLoginUser);

    ServiceResult<Integer> WMS_TestUpdatePickDemand(BMSEmployee wLoginUser, int wDemandID, String wDemandItemIDs);

    ServiceResult<Integer> WMS_IncomingLineSideLibrary_2(BMSEmployee wLoginUser, int wDemandID);

    ServiceResult<Integer> WMS_IncomingLineSideLibrary_3(BMSEmployee wLoginUser, int wDemandID,
                                                         WMSPickDemandItem wWMSPickDemandItem,
                                                         WMSPickDemandItemStock wWMSPickDemandItemStock);

    ServiceResult<String> WMS_ExportUseList(BMSEmployee wLoginUser, int wProductID, int wLineID, int wCustomerID,
                                            String wOrderIDs, int wPartID, int wPartPointID, String wMaterial,
                                            int wAreaID, int wIsPost,
                                            String wBatchNumber, Calendar wStartTime, Calendar wEndTime,
                                            String wPostMsgLike);

    ServiceResult<Integer> WMS_BatchReservedPosting(BMSEmployee wLoginUser,
                                                    List<WMSLineEdgeLibraryItem> wWMSLineEdgeLibraryItemList);

    ServiceResult<Integer> WMS_BatchReservedPostingByCondition(BMSEmployee wLoginUser, int wProductID, int wLineID,
                                                               int wCustomerID, String wOrderIDs, int wPartID,
                                                               int wPartPointID, String wMaterial,
                                                               int wAreaID, int wIsPost, String wBatchNumber,
                                                               Calendar wStartTime, Calendar wEndTime,
                                                               String wPostMsgLike, int wIsPostSetValue);

    ServiceResult<Integer> WMS_LineHandleData(BMSEmployee wLoginUser);

    ServiceResult<Integer> WMS_IncomingLineSideLibrary_4(BMSEmployee wLoginUser, int wBatchDemandID,
                                                         WMSBatchPickDemandItem wWMSBatchPickDemandItem,
                                                         WMSBatchPickDemandItemStock wWMSBatchPickDemandItemStock);

    ServiceResult<Integer> WMS_TechChangeByOrders(BMSEmployee wLoginUser, int wTechChangeNoticeID, String wOrderIDs);
}
